<template>
    <div style="width:100%" id="dplayer"></div>
</template>

<script>
import 'DPlayer/dist/DPlayer.min.css'
import flvjs from 'flv'
import DPlayer from 'DPlayer'
export default {
  name: 'Flv',
  props: {
    url: String
  },
  mounted () {
    const dp = new DPlayer({
      container: document.getElementById('dplayer'),
      video: {
        url: this.url,
        type: 'customFlv',
        customType: {
          'customFlv': function (video, player) {
            const flvPlayer = flvjs.createPlayer({
              type: 'flv',
              url: video.src
            });
            flvPlayer.attachMediaElement(video);
            flvPlayer.load();
          }
        }
      }
    });
  }
}
</script>
